package com.though.utils.tools;

import org.apache.commons.lang3.time.DateFormatUtils;

import java.text.SimpleDateFormat;
import java.util.Date;



public class OrderUtil {

	
	public static String createOrderNo(int orderType) {
		String date = DateFormatUtils.format(new Date(), DateUtils.dateFormat_YYYYMMDD);
		String rand = RandomUtil.randomNumber(5);
		StringBuilder sb = new StringBuilder();
		switch (orderType) {
		case 1:
			sb.append("AZ").append(date).append(rand);
			break;
		case 2:
			sb.append("AP").append(date).append(rand);
			break;
		case 3:
			sb.append("AC").append(date).append(rand);
			break;
		case 4:
			sb.append("AH").append(date).append(rand);
			break;
		case 5:
			sb.append("BD").append(date).append(rand);
			break;
		case 6:
			sb.append("AD").append(date).append(rand);
			break;
		case 7:
			sb.append("AB").append(date).append(rand);
			break;
		case 8:
			sb.append("YC").append(date).append(rand);
			break;
		case 9:
			sb.append("RG").append(date).append(rand);
			break;
		case 10:
			sb.append("JJ").append(date).append(rand);
			break;

		}
		return sb.toString();
	}
	/***
	 * 生成支付单号
	 * @Title: createPayNo
	 * @param: @return
	 * @return: String
	 */
	public static String createPayNo () {
		String dateStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
		String randStr = RandomUtil.randomNumber(10);
		StringBuilder sb = new StringBuilder();
		return sb.append(dateStr).append(randStr).toString();
	}
	
	/**
	 * 生成门店版出入库订单编号
	 * 
	 * @Title: createOrderNo
	 * @param: @return
	 * @return: String
	 */
	public static String createShopStockOrderNo(Integer orderType) {
		String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
		String randStr = RandomUtil.randomNumber(5);
		StringBuilder sb = new StringBuilder();

		switch (orderType) {
		case 1:
			sb.append("RC").append(dateStr).append(randStr);
			break;
		case 2:
			sb.append("CC").append(dateStr).append(randStr);
			break;
		}
		return sb.toString();
	}
}